<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
这是您第<span id="visitCount"></span>次访问页面：
<h4>您的访问记录</h4>
<div id="d1"></div>
<script>
   var visitList=localStorage.visitList;
   if(visitList){
       visitList=JSON.parse(visitList);
   }else{
       visitList=[];
   }
   var visit={
       visitTime:new Date().toLocaleString()
   };
   visitList.unshift(visit);
   visitCount.innerHTML=visitList.length;
   for(var i=0;i<visitList.length;i++){
       var newDiv=document.createElement("div");
       newDiv.innerHTML=visitList[i].visitTime;
       d1.appendChild(newDiv);
   }
   localStorage.visitList=JSON.stringify(visitList);
</script>
</body>
</html>